package com.evil.common.family.enums;

import com.evil.common.core.enums.BaseEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author liyang
 */
@Getter
@AllArgsConstructor
public enum RCodeEnum implements BaseEnum {

    /**
     * code - message
     */
    // region 系统    [0,-1,-2]
    // endregion

    // region 用户|部门|角色|权限   [2000|2100|2200|2300]
    USER_NOT_EXIST(2000, "用户不存在"),
    USER_CANT_MODIFY_TEL(2001, "手机号禁止修改"),
    USER_TEL_CANT_NULL(2002, "用户手机号不存在"),

    DEPARTMENT_NOT_EXIST(2100, "部门不存在"),
    DEPARTMENT_IS_DELETED(2100, "部门已被删除"),
    USER_DEPARTMENT_NOT_EXIST(2110, "用户部门不存在"),

    ROLE_NOT_EXIST(2200, "角色不存在"),
    ROLE_IS_DELETED(2201, "角色已被删除"),
    ROLE_CODE_IS_EXIST(2202, "角色CODE已存在"),

    USER_IN_DEPT_IS_EXIST(2301, "该账户已在指定部门"),
    USER_DEPT_NOT_EXIST(2302, "该账户不在指定部门"),
    DEPT_HAD_USER(2303, "该部门已存在指定用户"),
    DEPT_NO_HAD_USER(2304, "该部门不存在指定用户"),

    USER_IN_ROLE_IS_EXIST(2401, "该账户角色已存在"),
    USER_ROLE_NOT_EXIST(2401, "该账户角色不存在"),
    ROLE_HAD_USER(2303, "该角色已存在指定用户"),
    ROLE_NO_HAD_USER(2303, "该角色不存在指定用户"),
    // endregion

    // region 企业    [3000-3999]
    ENTERPRISE_NOT_EXIST(3001, "企业不存在或已被禁用"),
    USER_IN_ENTERPRISE_IS_EXIST(3002, "该账户已在指定企业"),
    USER_ENTERPRISE_NOT_EXIST(3003, "该账户不在指定企业"),
    USER_ENTERPRISE_DELETED(3004, "该用户已被移出企业"),
    USER_ENTERPRISE_DISABLED(3005, "该用户已被禁用"),
    PLATFORM_NOT_EXIST(3006, "平台不存在"),
    // endregion

    // region 认证    [4000-4999]
    ERROR_UNAUTHENTICATED(4001, "认证失败"),
    ERROR_UNAUTHORIZED(4002, "没有操作权限"),
    CODE_ERROR(4003, "验证码不正确"),
    PASSWORD_ERROR(4004, "账号或密码错误"),
    // endregion

    // region IO操作  [5000-5999]
    // endregion

    // region 数据库错误 [6000-6999]
    UPDATE_ERROR(6001, "操作失败"),
    DELETE_ERROR(6002, "删除失败"),
    ERROR_DB(6003, "数据库操作异常"),
    SAVE_REQUEST_LOG_ERROR(6004, "保存请求日志失败"),
    // endregion

    // region 业务类错误 [7000-7999]
    APPLICATION_ERROR(7000, "应用异常"),
    APPLICATION_PACKAGE_NOT_EXIST(7001, "应用包不存在"),
    APPLICATION_PACKAGE_DELETED(7002, "应用包已删除"),
    APPLICATION_PACKAGE_DISABLED(7003, "应用包已禁用"),
    APPLICATION_GROUP_NOT_EXIST(7004, "应用组不存在"),
    APPLICATION_GROUP_DELETED(7005, "应用组已删除"),
    APPLICATION_INFO_NOT_EXIST(7006, "应用不存在"),
    APPLICATION_INFO_DELETED(7007, "应用已删除"),
    APPLICATION_INFO_DISABLED(7008, "应用已禁用"),
    APPLICATION_INFO_UN_APPLY(7009, "应用已关闭申请通道"),
    APPLICATION_APPLY_MORE_THAN_LIMIT(7010, "申请通道已超过限定"),
    APPLICATION_APPLY_SETTING_NOT_EXIST(7011, "应用提交配置信息不存在"),
    APPLICATION_APPLY_SETTING_DELETED(7012, "应用提交配置信息已删除"),
    APPLICATION_NOTIFY_SETTING_NOT_EXIST(7013, "应用提醒配置信息不存在"),
    APPLICATION_NOTIFY_SETTING_DELETED(7014, "应用提醒配置信息已删除"),
    APPLICATION_UN_PUSHED(7019, "应用未发布"),

    APPLICATION_FORM_NOT_EXIST(7020, "应用表单不存在"),
    APPLICATION_FORM_DELETED(7022, "应用表单已删除"),
    APPLICATION_FORM_CONTROL_NOT_EXIST(7023, "应用表单控件不存在"),
    APPLICATION_FORM_CONTROL_DELETED(7024, "应用表单控件已删除"),
    APPLICATION_FORM_CONTROL_FIELD_REPEAT(7025, "应用表单控件field重复"),
    APPLICATION_FORM_CONTROL_OPTION_NOT_EXIST(7026, "应用表单控件选项不存在"),
    APPLICATION_FORM_CONTROL_OPTION_DELETED(7027, "应用表单控件选项已删除"),
    CONTROL_CONTROL_RELATED_NOT_EXIST(7027, "控件关联设置信息不存在"),
    CONTROL_CONTROL_RELATED_ERROR(7028, "控件关联设置信息有误"),

    APPLICATION_PROCESS_NOT_EXIST(7030, "应用流程不存在"),
    APPLICATION_PROCESS_DELETED(7031, "应用流程已删除"),
    APPLICATION_PROCESS_NODE_NOT_EXIST(7032, "应用流程节点不存在"),
    APPLICATION_PROCESS_NODE_DELETED(7033, "应用流程节点已删除"),
    APPLICATION_PROCESS_NODE_CANT_DELETE(7034, "禁止删除流程根节点"),
    APPLICATION_PROCESS_START_NODE_NOE_EXIST(7035, "应用流程节点缺少开始节点"),
    APPLICATION_PROCESS_END_NODE_NOE_EXIST(7036, "应用流程节点缺少结束节点"),
    APPLICATION_PROCESS_NODE_HANDLERS_EMPTY(7037, "节点处理人不能为空"),
    APPLICATION_PROCESS_END_NODE_CANT_EDIT(7038, "结束节点禁止编辑"),
    CHOOSE_FALL_BACK_NODE(7039, "请选择需要回退节点"),

    APPLICATION_VIEW_NOT_EXIST(7040, "应用视图不存在"),
    APPLICATION_VIEW_DELETED(7041, "应用视图已删除"),
    APPLICATION_FILTER_GROUP_NOT_EXIST(7042, "应用筛选组不存在"),
    APPLICATION_FILTER_GROUP_DELETED(7043, "应用筛选组已删除"),
    APPLICATION_FILTER_ITEM_NOT_EXIST(7044, "应用筛选项不存在"),
    APPLICATION_FILTER_ITEM_DELETED(7045, "应用筛选项已删除"),

    APPLICATION_BUTTON_NOT_EXIST(7050, "按钮不存在"),
    APPLICATION_BUTTON_DELETED(7051, "按钮已删除"),
    APPLICATION_BUTTON_CANT_MODIFY(7052, "不允许编辑发布版按钮"),

    APPLICATION_ROBOT_NOT_EXIST(7060, "应用机器人不存在"),
    APPLICATION_ROBOT_DELETED(7061, "应用机器人已删除"),
    ROBOT_RULE_TARGET_CANT_REPEAT(7062, "规则目标字段不能重复"),
    ROBOT_LOG_NOT_EXIST(7069, "机器人日志不存在"),

    APPLICATION_PRINT_TEMPLATE_DELETED(7070, "应用打印模板已删除"),
    APPLICATION_PRINT_TEMPLATE_NOT_EXIST(7071, "应用打印模板不存在"),
    APPLICATION_IMPORT_TEMPLATE_DELETED(7072, "应用导入模板已删除"),
    APPLICATION_IMPORT_TEMPLATE_NOT_EXIST(7073, "应用导入模板不存在"),
    APPLICATION_IMPORT_TEMPLATE_ANALYSIS_ERROR(7075, "应用导入模板解析错误"),
    APPLICATION_IMPORT_CREATOR_NOT_FOUND(7076, "应用导入申请人不存在"),

    APPLICATION_JUDGE_NOT_EXIST(7081, "应用判断条件不存在"),

    APPLICATION_REPORTING_NOT_EXIST(7090, "应用报表不存在"),
    APPLICATION_REPORTING_DELETED(7091, "应用报表已删除"),
    APPLICATION_REPORTING_PARAM_ERROR(7092, "报表维度（行、列、指标）参数错误"),
    APPLICATION_REPORTING_PARAM_REPEAT(7093, "报表维度（行、列、指标）参数重复"),
    APPLICATION_REPORTING_PARAM_COUNT(7094, "报表维度（行、列、指标）参数超出限制"),
    APPLICATION_REPORTING_SORT_ERROR(7098, "排序配置参数错误"),
    APPLICATION_REPORTING_RANKING_ERROR(7099, "排名配置参数错误"),

    APPLICATION_PERMISSION_NOT_EXIST(7100, "应用权限不存在"),

    APPLICATION_QUEUE_NOT_EXIST(7200, "应用队列不存在"),
    APPLICATION_QUEUE_DELETED(7201, "应用队列已删除"),

    APPLICATION_ORDER_NOT_EXIST(7500, "应用订单不存在"),
    APPLICATION_ORDER_DELETED(7501, "应用订单已删除"),
    APPLICATION_ORDER_IS_SUBMIT(7502, "应用订单已提交请勿重复提交"),
    APPLICATION_ORDER_NOT_PROCESSING(7503, "应用订单流程未开始或已结束"),
    APPLICATION_ORDER_CANT_COPY(7504, "该应用订单不允许复制"),

    APPLICATION_ORDER_DATA_NOT_EXIST(7510, "应用订单数据不存在"),
    APPLICATION_ORDER_DATA_DELETED(7511, "应用订单数据已删除"),
    // endregion

    // region 业务类错误（插件） [8000-8999]
    GENERATE_SN_ERROR(8001, "生成编号错误"),

    ACTIVITY_TASK_NOT_EXIST(8101, "该流程实例不存在"),
    ACTIVITY_COMPLETE_ERROR(8102, "工作流流转失败"),
    ACTIVITY_ASSIGNEE_NOT_EXIST(8103, "节点[%s]无有效处理人"),
    ACTIVITY_LOST_END_NODE(8104, "该流程缺少结束节点"),
    ACTIVITY_PROCESS_DEFINITION_NOT_EXIST(8105, "流程定义不存在"),
    ACTIVITY_PROCESS_NODE_ERROR(8106, "流程节点信息错误"),
    ACTIVITY_PROCESS_NODE_HANDLERS_ERROR(8107, "节点处理人错误"),
    ACTIVITY_PROCESS_ROBOT_SOURCE_CONTROL_NOT_EXIST(8108, "源订单数据控件不存在"),
    ACTIVITY_PROCESS_ROBOT_TARGET_CONTROL_NOT_EXIST(8109, "目标应用控件不存在"),

    FORMULA_ERROR(8201, "计算公式错误"),

    ELASTICSEARCH_ERROR(8300, "搜索引擎操作失败"),
    // endregion
    ;

    /**
     * code
     */
    private final int code;
    /**
     * message
     */
    private final String message;
}
